<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2020/11/8
  Time: 20:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>list</title>
    <script src="../HTML/js/jquery-3.4.1.js"></script>
    <style>
        body{
            font: 16px "Microsoft YaHei";
        }
        ul{
            list-style: none;
            padding: 0;
            margin: 0;
        }
        a{
            text-decoration: none;
        }
        .nav-list{
            width: 220px;
        }
        .nav-list ul{
            display: none;
        }
        .nav-list>h3{
            margin: 0;
            position: relative;
            padding: 10px 20px;
            margin-bottom: 5px;
            background-color: rgb(97,166,0);
            color: white;
            font-size: 16px;
            line-height: 20px;
            font-weight: normal;
            border-top: 1px solid #ccc;
            cursor: pointer;
        }
        .nav-list>h3:hover{
            background-color: rgb(75,156,1);
        }
        .nav-list>h3>span{
            position: absolute;
            width: 16px;
            height: 16px;
            background: url("sc/right.png") no-repeat;
            right: 20px;
            top: 12px;
        }

        .nav-list>.open span{
            position: absolute;
            width: 16px;
            height: 16px;
            background: url("sc/buttom.png") no-repeat;
            right: 20px;
            top: 12px;
        }
        .nav-list li>a{
            display: block;
            padding: 10px 20px;
            background: rgb(35,35,35);
            color: #fff;
            font-size: 14px;
        }
        .nav-list li>a:hover{
            background-color: black;
        }

    </style>
</head>
<body>
<div class="nav-list">
    <h3>系统管理<span></span></h3>
    <ul>
        <li><a href="javascript:void(0);" id="stop">停用系统</a></li>
        <li><a href="javascript:void(0);" id="start">恢复系统</a></li>
        <li><a href="javascript:void(0);" id="systemstate">当前系统状态</a></li>
    </ul>
    <h3>管理员管理<span></span></h3>
    <ul>
        <li><a href="/SuperAdminServlet?type=alladmin" target="rightbottom">查看所有管理</a></li>
        <li><a href="/SuperAdminServlet?type=selectalladmin" target="rightbottom">新增超级管理员</a></li>
        <li><a href="/WebContent/HTML/SuperAdminPage/superadmin_admin/addadmin.jsp" target="rightbottom">新增普管</a></li>
    </ul>
    <h3>用户管理<span></span></h3>
    <ul>
        <li><a href="/SuperAdminServlet?type=allusers" target="rightbottom">管理所有用户</a></li>
    </ul>
    <h3>友情链接<span></span></h3>
    <ul>
        <li><a href="javascript:void(0);" target="rightbottom">学校官网</a></li>
        <li><a href="http://hall.nmu.edu.cn/" target="rightbottom">智慧校园</a></li>
        <li><a href="javascript:void(0);" target="rightbottom">教务系统</a></li>
        <li><a href="javascript:void(0);" target="rightbottom">民大风采</a></li>
    </ul>

</div>
<script>
    $(document).ready(function(){
        $("h3").click(function(){
            $(this).addClass("open").siblings("h3").removeClass("open").end().next("ul").show("1").siblings("ul").hide();
        })
        $("#stop").click(function () {
                $.ajax({
                    url:"/SystemGL",
                    async:false,
                    type:"get",
                    data:{
                        "type":"logincheck"
                    },
                    dataType:"text",
                    success:function (x) {
                        if(x == "1"){
                            if(confirm("确定要停用系统吗？")){
                                $.ajax({
                                    url:"/SystemGL",
                                    async:false,
                                    type:"get",
                                    data:{
                                        "type":"stop"
                                    },
                                    dataType:"text",
                                    success:function (data) {
                                        if(data == "1"){
                                            alert("系统停用成功！");
                                        }else{
                                            alert("操作失败！");
                                        }

                                    }
                                })
                            }else{
                                return false;
                            }

                        }else if(x == "0"){
                            alert("系统已暂停，请勿重复提交！")
                        }
                    },
                    error:function (error) {
                        alert("请求失败！")
                    }
                })
        })
        $("#start").click(function () {
            $.ajax({
                url:"/SystemGL",
                async:false,
                type:"get",
                data:{
                    "type":"logincheck"
                },
                dataType:"text",
                success:function (x) {
                    if(x == "0"){
                        if(confirm("确定要启用系统吗？")){
                            $.ajax({
                                url:"/SystemGL",
                                async:false,
                                type:"get",
                                data:{
                                    "type":"start"
                                },
                                dataType:"text",
                                success:function (data) {
                                    if(data == "1"){
                                        alert("系统启动成功！");
                                    }else{
                                        alert("操作失败！");
                                    }

                                }
                            })
                        }else{
                            return false;
                        }

                    }else if(x == "1"){
                        alert("系统已启用，请勿重复操作！")
                    }
                },
                error:function (error) {
                    alert("请求失败！")
                }
            })
        })
        $("#systemstate").click(function () {
            $.ajax({
                url:"/SystemGL",
                async:false,
                type:"get",
                data:{
                    "type":"logincheck"
                },
                dataType:"text",
                success:function (x) {
                    if(x == "1"){
                        alert("系统状态：正常");
                    }else if(x == "0"){
                        alert("系统状态：暂停服务");
                    }
                },
                error:function (error) {
                    alert("请求失败！")
                }
            })
        })
    })
</script>

</body>
</html>